package com.yy.rocketmq.controller;

import com.yy.rocketmq.rocketmq.MyMQProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/rocket")
public class TestController {

    private final String TOPIC = "TestTopic";

    @Autowired
    private MyMQProducer producer;

    @GetMapping("/send")
    public void send() {
        producer.send(TOPIC, "Hello World");
    }

    @GetMapping("syncSend")
    public void syncSend() {
        producer.syncSend(TOPIC, "syncSend");
    }

    @GetMapping("asyncSend")
    public void asyncSend() {
        producer.asyncSend(TOPIC, "asyncSend");
    }
}
